import 'package:flutter/material.dart';

class BottomActionSheet extends StatelessWidget {
  final List<ActionSheetItem> items;

  const BottomActionSheet({super.key, required this.items});

  @override
  Widget build(BuildContext context) {
    return SafeArea(
      child: Container(
        decoration: BoxDecoration(
          borderRadius: BorderRadius.vertical(top: Radius.circular(16)),
          color: Colors.white,
        ),
        child: Column(
          mainAxisSize: MainAxisSize.min,
          children: items.map((item) {
            return ListTile(
              leading: item.icon != null ? Icon(item.icon) : null,
              title: Center(
                child: Text(
                  item.title,
                  style: item.textStyle ??
                      TextStyle(
                        color: item.isCancel ? Colors.red : Colors.black,
                        fontWeight:
                        item.isCancel ? FontWeight.bold : FontWeight.normal,
                      ),
                ),
              ),
              onTap: () {
                Navigator.pop(context);
                item.onTap();
              },
            );
          }).toList(),
        ),
      ),
    );
  }
}
class ActionSheetItem {
  final String title;
  final IconData? icon;
  final VoidCallback onTap;
  final TextStyle? textStyle;
  final bool isCancel;

  ActionSheetItem({
    required this.title,
    required this.onTap,
    this.icon,
    this.textStyle,
    this.isCancel = false,
  });
}
